﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using System.Web.Http.Description;
using FANUC;
using FANUC.DTO;
using FANUC.BLL;

namespace FANUC.Controllers
{
    public class Parameter_VersionController : ApiController
    {
        private TraceService service = new TraceService();

        public IHttpActionResult Get(string partSerial, int hours = 4)
        {
            var data = service.GetRelativeParameterChangeHistory(partSerial, hours);
            return Ok(data);
        }

        public IHttpActionResult Post(ParameterChangesSearchDtoIn input)
        {
            var data = service.GetParameterChanges(input);
            return Ok(data);
        }

        [ApiExplorerSettings(IgnoreApi = true)]
        public string Options()
        {
            return null;
        }
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                service.Dispose();
            }
            base.Dispose(disposing);
        }
    }
}